import { lazy } from 'react'
/* -------------------------------------------------------- Declare -- */
const { $http } = window
/* -------------------------------------------------------- Async Component -- */
const Page = lazy(()=>import('#tp/content/page-content'))
const Controls = lazy(()=>import('#cpt/temp/Controls'))
/* -------------------------------------------------------- Page Component -- */
const Index = () => {
	const data = [
		{ label:'视频流服务器', ghost:1, link:'http://127.0.0.1:8088'},
		{ label:'打开弹窗摄像头', ghost:1,  click:()=>$http.post(null, 'opencv/open_highgui')},
		{ label:'拍照', ghost:1,  click:()=>{
			$http.post(null, 'opencv/take_photo').then(() => {
				document.querySelector('#img').src = 'http://localhost:8081/upload/b.jpg?=' + Date.now()
			})
		}},
		{ label:'画面置灰', ghost:1,  click:()=>$http.post(null, 'opencv/video_gray')},
		{ label:'人脸跟踪', ghost:1,  click:()=>$http.post(null, 'opencv/face')},
		{ label:'特征', ghost:1,  click:()=>$http.post(null, 'opencv/features')},
	]
	return (
		<Page title='视频操作' scroll paddingClass='p10'>
			<Controls align='start' data={data}/>
			<img id='img' className='mt10' src='http://localhost:8081/upload/b.jpg' style={{width:500, height:500}}/>
		</Page>
	)
}
export default Index